package com.gxa.learning.portal.service.impl;

import com.gxa.learning.core.pojo.ProjectApply;
import com.gxa.learning.core.service.impl.BaseServiceImpl;
import com.gxa.learning.portal.mapper.ProjectApplyMapper;
import com.gxa.learning.portal.service.ProjectApplyService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Map;

/**
 * @author lijianmin
 * @date 2021/12/10  11:36:02
 */
@Service("projectApplyService")
public class ProjectApplyServiceImpl extends BaseServiceImpl<ProjectApply> implements ProjectApplyService {

    @Resource
    private ProjectApplyMapper projectApplyMapper;

    @Override
    public List<Map<String, Object>> selectRegistration(Long id) {
        List<Map<String, Object>> maps = projectApplyMapper.selectRegistration(id);
        for (Map<String, Object> map : maps) {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String applyEndTime = sdf.format(map.get("applyEndTime"));
            String projectStartTime = sdf.format(map.get("projectStartTime"));
            String projectEndTime = sdf.format(map.get("projectEndTime"));
            map.put("applyEndTime", applyEndTime);
            map.put("projectStartTime", projectStartTime);
            map.put("projectEndTime", projectEndTime);
        }
        return maps;
    }
}
